import sys

import click
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QPushButton

def click():
    print("Hy Button is clicked!")

app = QApplication(sys.argv)
win = QMainWindow()

win.setGeometry(400, 400, 400, 300) # 位置和大小 x y width height
win.setWindowTitle("Pyqt5 Tutorial") # 标题

# Label Text
label = QLabel(win)
label.resize(200, 100)
label.setText("Hi this is Pyqt5")
label.move(100, 100)

# Button
button = QPushButton(win)
button.resize(200, 100)
button.setText("Hi! Click Me")
button.move(100, 100)
button.clicked.connect(click)

win.show() # 显示窗口

sys.exit(app.exec_()) #当点X关闭窗口
